import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export const useGlobalStore = defineStore('global', () => {
  //产品选择列表
  const productList = ref([{
    id: 0,
    name: "新鲜水果",
    icon: "svg_1.svg"
  }, {
    id: 1,
    name: "新鲜蔬菜",
    icon: "svg_2.svg"
  }, {
    id: 2,
    name: "油粮米面",
    icon: "svg_3.svg"
  }, {
    id: 3,
    name: "每鲜水产",
    icon: "svg_4.svg"
  }, {
    id: 4,
    name: "干果坚果",
    icon: "svg_5.svg"
  }, {
    id: 5,
    name: "新鲜肉类",
    icon: "svg_6.svg"
  }, {
    id: 6,
    name: "干货产品",
    icon: "svg_7.svg"
  }])

  //当前选择类别序号
  let productIndex = ref(-1)

  //用户是否登入
  let isLogin = ref(false)

  //鼠标是否悬浮在头像上
  let isHover = ref(false)

  //鼠标是否悬浮在个人板块上
  let isHoverPerson = ref(false)

  //热销产品数据
  let hotProductList = ref([
  ])

  //顶部菜单栏列表
  const topMenuList = ref([
    {
      id: 0,
      name: "首页"
    }, {
      id: 1,
      name: "咨询信息"
    }, {
      id: 2,
      name: "秒杀"
    }, {
      id: 3,
      name: "招商加盟"
    }, {
      id: 4,
      name: "公司介绍"
    }
  ])
  //当前选择顶部菜单栏序号
  let topMenuIndex = ref(0)

  //主页轮播图数据
  let homeSwiperList = ref([
    {
      id: 0,
      img: "swiper_1.png",
      title: "美丽农村:新鲜土豆,厂家直供"
    }, {
      id: 1,
      img: "swiper_2.png",
      title: "苗家鲜土豆粉,开封即食"
    }, {
      id: 2,
      img: "swiper_3.png",
      title: "草原直销:新鲜牛腩,土豆牛腩食谱"
    }, {
      id: 4,
      img: "swiper_1.png",
      title: "美丽农村:新鲜土豆,厂家直供"
    }, {
      id: 5,
      img: "swiper_2.png",
      title: "苗家鲜土豆粉,开封即食"
    }, {
      id: 6,
      img: "swiper_3.png",
      title: "草原直销:新鲜牛腩,土豆牛腩食谱"
    }
  ])

  //平台新闻
  let newsList = ref([
    {
      id: 0,
      image: "news_1.png"
    }
  ])

  //猜你喜欢
  let guessProductList = ref([
    {
      id: 0,
      name: "土豆",
      image: "guess_1.png"
    }, {
      id: 1,
      name: "土豆粉",
      image: "guess_2.png"
    }, {
      id: 2,
      name: "牛肉",
      image: "guess_3.png"
    }])

  //当前选择主要页面类型序号
  let mainPageTypeIndex = ref(0)

  //产品信息列表（新鲜蔬菜）
  let productInfoList = ref([ // 0:新鲜水果,1：新鲜蔬菜,2：油粮米面,3：每鲜水产,4：干果坚果,5：新鲜肉类,6：干货产品
    //新鲜水果
    {
      id: 0,
      name: "优质济南橙子",
      image: "product_1.png",
      price: "3.9",
      //是否优选
      isPrefer: true,
      sale: "400+",
      desc: "简称济橙，济南千亩果园现产现摘现发货，保证新鲜到你家。",
      //农场名
      farmName: "爷爷家农场",
      //农场星数
      farmStar: 4,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
      productTypeId: 0 //0:新鲜水果,依次往后
    },
    {
      id: 1,
      name: "毛毛果",
      image: "product_2.png",
      price: "4.8",
      //是否优选
      isPrefer: true,
      sale: "400+",
      desc: "毛毛优质挑选，保证是全果园最甜的果子",
      //农场名
      farmName: "山东东营农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["一件包邮", "退货包运费"],
      productTypeId: 0
    },
    {
      id: 2,
      name: "苹果",
      image: "product_3.png",
      price: "4.2",
      //是否优选
      isPrefer: false,
      sale: "20+",
      desc: "一天一苹果，医生远离我",
      //农场名
      farmName: "中国新农农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["最小起订量：5kg"],
      productTypeId: 0
    },
    {
      id: 3,
      name: "新鲜车厘子",
      image: "product_4.png",
      price: "3.9！",
      //是否优选
      isPrefer: true,
      sale: "400+",
      desc: "超绝国产车厘子，超越智利，物美价廉。甜到你的心趴。",
      //农场名
      farmName: "爸爸家农场",
      //农场星数
      farmStar: 4,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
      productTypeId: 0
    },
    {
      id: 4,
      name: "阳光玫瑰",
      image: "product_5.png",
      price: "17.89",
      //是否优选
      isPrefer: false,
      sale: "500+",
      desc: "这个夏天，我们会让每个人都吃上又甜又大颗的阳光玫瑰！",
      //农场名
      farmName: "爷爷家农场",
      //农场星数
      farmStar: 4,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
      productTypeId: 0
    },
    {
      id: 5,
      name: "白心芭乐",
      image: "product_6.png",
      price: "7.9",
      //是否优选
      isPrefer: true,
      sale: "800+",
      desc: "国民水果芭乐，美容养颜产地直销，新鲜看得见。",
      //农场名
      farmName: "山东东营农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["一件包邮", "退货包运费"],
      productTypeId: 0
    },
    //新鲜蔬菜
    {
      id: 6,
      name: "新鲜西红柿番茄",
      image: "product_7.png",
      price: "3.9",
      //是否优选
      isPrefer: true,
      sale: "400+",
      desc: "正宗吐鲁番番茄，不一样的甜美。酸酸甜甜好味道适合做饭亦可生食",
      //农场名
      farmName: "吐鲁番农场",
      //农场星数
      farmStar: 4,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
      productTypeId: 1
    },
    {
      id: 7,
      name: "西兰花",
      image: "8.png",
      price: "4.8",
      //是否优选
      isPrefer: true,
      sale: "400+",
      desc: "西三花西三花西三花西三花。保证新鲜保证新鲜保证新鲜保证新鲜!!!",
      //农场名
      farmName: "吐鲁番农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["一件包邮", "退货包运费"],
      productTypeId: 1
    },
    {
      id: 8,
      name: "上海青蔬菜",
      image: "product_9.png",
      price: "4.2",
      //是否优选
      isPrefer: false,
      sale: "20+",
      desc: "我叫上海青，但我不一定产自上海，你在哪里，我就产自哪里。家门口的新鲜直送。绝不过夜。",
      //农场名
      farmName: "中国新农农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["最小起订量：5kg"],
      productTypeId: 1
    },
    {
      id: 9,
      name: "新鲜芹菜",
      image: "product_10.png",
      price: "3.9",
      //是否优选
      isPrefer: true,
      sale: "400+",
      desc: "优质蔬菜纤维，新鲜清脆芹菜。祝您吃的爽口，拉的通畅。",
      //农场名
      farmName: "爸爸家农场",
      //农场星数
      farmStar: 4,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
      productTypeId: 1
    },
    {
      id: 10,
      name: "青椒辣椒菜辣椒",
      image: "product_11.png",
      price: "17.89",
      //是否优选
      isPrefer: false,
      sale: "500+",
      desc: "新鲜辣椒，可生食亦可炒菜配菜。",
      //农场名
      farmName: "爷爷家农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
      productTypeId: 1
    },
    {
      id: 11,
      name: "娃娃菜嫩白菜",
      image: "product_12.png",
      price: "7.9",
      //是否优选
      isPrefer: true,
      sale: "800+",
      desc: "国民宴席上汤娃娃菜优质大白菜，进过国家会堂的娃娃菜。",
      //农场名
      farmName: "山东东营农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["一件包邮", "退货包运费"],
      productTypeId: 1
    },
    //粮油米面
    {
      id: 12,
      name: "土豆低价包邮批",
      image: "product_13.png",
      price: "3.9",
      //是否优选
      isPrefer: true,
      sale: "400+",
      desc: "批发洋芋，白皮优质蔬菜马铃薯。农家自种现挖新鲜直供。",
      //农场名
      farmName: "爷爷农场",
      //农场星数
      farmStar: 4,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
      productTypeId: 2
    },
    {
      id: 13,
      name: "土豆新鲜直达",
      image: "product_14.png",
      price: "4.8",
      //是否优选
      isPrefer: true,
      sale: "400+",
      desc: "沙甜软糯，坏果包赔",
      //农场名
      farmName: "吐鲁番农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["一件包邮", "退货包运费"],
      productTypeId: 2
    },
    {
      id: 14,
      name: "非转基因大豆油",
      image: "product_15.png",
      price: "4.2",
      //是否优选
      isPrefer: false,
      sale: "20+",
      desc: "我是非转基因大豆油，没有其它油可以打败我。",
      //农场名
      farmName: "中国新农农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["最小起订量：5kg"],
      productTypeId: 2
    },
    {
      id: 15,
      name: "新鲜面粉，手工制作",
      image: "product_16.png",
      price: "3.9",
      //是否优选
      isPrefer: true,
      sale: "400+",
      desc: "手工磨粉，运用非转基因超强小麦，配合人工手磨，给你不一样的体验。",
      //农场名
      farmName: "爸爸家农场",
      //农场星数
      farmStar: 4,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
    },
    {
      id: 16,
      name: "优质东北大米",
      image: "product_17.png",
      price: "17.89",
      //是否优选
      isPrefer: false,
      sale: "500+",
      desc: "东北大米就是最好吃的大米。",
      //农场名
      farmName: "爷爷家农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
      productTypeId: 2
    },
    {
      id: 17,
      name: "土豆冷冻薯条",
      image: "product_18.png",
      price: "7.9",
      //是否优选
      isPrefer: true,
      sale: "800+",
      desc: "最低出厂价，厂家直供。",
      //农场名
      farmName: "山东东营农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["一件包邮", "退货包运费"],
      productTypeId: 2
    },
    //海鲜水产
    {
      id: 18,
      name: "新鲜金龙鱼",
      image: "product_19.png",
      price: "22.9",
      //是否优选
      isPrefer: true,
      sale: "300+",
      desc: "有营业执照合法人工养殖，放心食用。",
      //农场名
      farmName: "爷爷农场",
      //农场星数
      farmStar: 4,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
      productTypeId: 3
    },
    {
      id: 19,
      name: "养殖新鲜秋刀鱼",
      image: "product_20.png",
      price: "32.8",
      //是否优选
      isPrefer: true,
      sale: "160+",
      desc: "绝对无不受核污染海水影响，绝对新鲜。",
      //农场名
      farmName: "吐鲁番农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["一件包邮", "退货包运费"],
      productTypeId: 3
    },
    {
      id: 20,
      name: "新鲜老虎虾",
      image: "product_21.png",
      price: "27.9",
      //是否优选
      isPrefer: false,
      sale: "50+",
      desc: "如需提前加工请联系店老板。",
      //农场名
      farmName: "中国新农农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["最小起订量：5kg"],
      productTypeId: 3
    },
    {
      id: 21,
      name: "去壳虾仁",
      image: "product_22.png",
      price: "17.9",
      //是否优选
      isPrefer: true,
      sale: "400+",
      desc: "保证新鲜，保证质量。",
      //农场名
      farmName: "爸爸家农场",
      //农场星数
      farmStar: 4,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
      productTypeId: 3
    },
    //stop!!!!!!!!!!!!!!!!!
    {
      id: 22,
      name: "新鲜三文鱼",
      image: "product_23.png",
      price: "47.89",
      //是否优选
      isPrefer: false,
      sale: "500+",
      desc: "新鲜三文鱼，保证新鲜。",
      //农场名
      farmName: "爷爷家农场",
      //农场星数
      farmStar: 5,
      //细节
      details: ["一件包邮", "退货包运费", "后天达"],
      productTypeId: 3
    },

  ])

  //当前主要页面类型列表
let mainPageTypeList = ref({
  "HomePage": {
    id: 0,
    name: "首页"
  },
  "ProductShowPage": {
    id: 1,
    name: "产品展示"
  },
  "ConsultationPage": {
    id: 2,
    name: "咨询信息"
  },
  "SeckillPage": {
    id: 3,
    name: "秒杀"
  },
  "JoinPage": {
    id: 4,
    name: "招商加盟"
  },
  "AboutPage": {
    id: 5,
    name: "公司介绍"
  },
  "RegisterPage": {
    id: 6,
    name: "注册"
  },
  "LoginPage": {
    id: 7,
    name: "登录"
  },
  "findPasswordPage": {
    id: 8,
    name: "找回密码"
  }
})
  return {
    productList,
    productIndex,
    topMenuList,
    topMenuIndex,
    guessProductList,
    isLogin,
    isHover,
    isHoverPerson,
    hotProductList,
    homeSwiperList,
    newsList,
    mainPageTypeIndex,
    productInfoList,
    mainPageTypeList
  }
})
